import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/screenLayout'
export const constantRoutes = [
    // 大屏菜单
    { 
        path: '/',
        component: Layout,
        redirect: '/supervision',
        children: [
          {
            path: '/supervision',
            component: (resolve) => require(['@/screenLayout/supervision'], resolve),
            name: 'supervision',
            meta: { title: '行政监管业务体系',}
          },
          {
            path: '/relativePerson',
            component: (resolve) => require(['@/screenLayout/relativePerson'], resolve),
            name: 'relativePerson',
            meta: { title: '法人监管',}
          },
          {
            path: '/server',
            component: (resolve) => require(['@/screenLayout/server'], resolve),
            name: 'Server',
            meta: { title: '区县地图',}
          }, 
          {
            path: '/load',
            component: (resolve) => require(['@/screenLayout/load'], resolve),
            name: 'Load',
            meta: { title: '服务水平排行',}
          },{
            path: '/effect',
            component: (resolve) => require(['@/screenLayout/effect'], resolve),
            name: 'Effect',
            meta: { title: '业务效能',}
          },
          {
            path: '/check',
            component: (resolve) => require(['@/screenLayout/business_copy'], resolve),
            name: 'Check',
            meta: { title: '巡检督查',}
          },
          {
            path: '/prevent',
            component: (resolve) => require(['@/screenLayout/prevent'], resolve),
            name: 'Prevent',
            meta: { title: '满意度统计',}
          },
          {
            path: '/risk',
            component: (resolve) => require(['@/screenLayout/risk'], resolve),
            name: 'Risk',
            meta: { title: '风险统计',}
          },
          {
            path: '/business',
            component: (resolve) => require(['@/screenLayout/business'], resolve),
            name: 'Business',
            meta: { title: '效能监督',}
          },
          {
            path: '/examine',
            component: (resolve) => require(['@/screenLayout/examine'], resolve),
            name: 'Examine',
            meta: { title: '满意度考核',}
          },
          {
            path: '/warning',
            component: (resolve) => require(['@/screenLayout/warning'], resolve),
            name: 'Warning',
            meta: { title: '风险预警',}
          },
          {
            path: '/loadbearing',
            component: (resolve) => require(['@/screenLayout/loadbearing'], resolve),
            name: 'Loadbearing',
            meta: { title: '业务承载',}
          },
          // {
          //   path: '/supervision',
          //   component: (resolve) => require(['@/screenLayout/supervision'], resolve),
          //   name: 'supervision',
          //   meta: { title: '行政监管业务体系',}
          // },
          {
            path: '/supervisionUser',
            component: (resolve) => require(['@/screenLayout/supervisionUser'], resolve),
            name: 'supervisionUser',
            meta: { title: '相对人监管',}
          },
          {
            path: '/townsRegulatory',
            component: (resolve) => require(['@/screenLayout/townsRegulatory'], resolve),
            name: 'townsRegulatory',
            meta: { title: '镇街监管',}
          },
          {
            path: '/departmentRegulatory',
            component: (resolve) => require(['@/screenLayout/departmentRegulatory'], resolve),
            name: 'departmentRegulatory',
            meta: { title: '部门监管',}
          },
          {
            path: '/rankingList',
            component: (resolve) => require(['@/screenLayout/rankingList'], resolve),
            name: 'rankingList',
            meta: { title: '排行榜',}
          }
        ]
      },
    {
        path: '*',
        redirect: '/404',
        hidden: true
    }
]


export const asyncRoutes = [
   
]

const createRouter = () => new Router({
    // mode: 'history', // require service support
    scrollBehavior: () => ({
        y: 0
    }),
    routes: constantRoutes
})

const router = createRouter()

export function resetRouter() {
    const newRouter = createRouter()
    router.matcher = newRouter.matcher // reset router
}

export default router